package com.cyh.testdesignpattern.appearance;

//外观模式
public class HomeTheaterFacade {
    private DVDPlayer dvdPlayer;
    private Popcorn popcorn;
    private Projector projector;
    private  Screen screen;

    public HomeTheaterFacade() {
        dvdPlayer = DVDPlayer.getInstance();
        popcorn = Popcorn.getInstance();
        projector = Projector.getInstance();
        screen = Screen.getInstance();
    }

    //操作分步骤
    public void ready() {
        dvdPlayer.on();
        popcorn.on();
        projector.on();
        screen.down();
    }

    public void play() {
        dvdPlayer.play();
    }

    public void pause() {
        dvdPlayer.pause();
    }

    public void end() {
        dvdPlayer.off();
        popcorn.on();
        projector.off();
        screen.up();
    }
}
